<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="/css/styletable.css" type="text/css"/>
    <link rel="stylesheet" href="/layui/css/layui.css" media="all">
    <script src="/layui/layui.all.js" charset="utf-8"></script>
    <script src="/js/jquery.2.1.4.js" charset="utf-8"></script>
</head>
<body>
<script>
    function pass() {
        if ($(".check:checked").size() == 0) {
            layer.alert('请至少选一项', {
                skin: 'layui-layer-molv'
                , closeBtn: 0
            });
        } else {
            $("#overform").attr("action", "/prob/pass").submit();
        }
    }

    function unpass() {
        if ($(".check:checked").size() == 0) {
            layer.alert('请至少选一项', {
                skin: 'layui-layer-molv'
                , closeBtn: 0
            });
        } else {
            $("#overform").attr("action", "/prob/unpass").submit();
        }
    }

    function detail(th) {
        var prob;
        var pid = $(th).parent().prevAll(".pid").children().val();
        var ptitle = $(th).parent().prevAll(".ptitle").html();
        layer.open({
            title: ptitle,
            type: 2,
            area: ['85%', '85%'],
            content: '/prob/detail/' + pid
        });
        return false;
    }
</script>
<div style="margin: 10px 15px 0px 15px">
    <div style="margin-top: 1px;margin-left: 1px;margin-bottom: 8px">
        <button class="layui-btn layui-btn-edit" onclick="pass();">通过</button>
        <button class="layui-btn layui-btn-normal" onclick="unpass();">不通过</button>
    </div>
    <form id="overform">
        <table style="width: 100%">
            <tr>
                <th width="5%"></th>
                <th width="38%">标题</th>
                <th width="17%">创建时间</th>
                <th width="10%">延期天数</th>
                <th width="15%">审批状态</th>
                <th width="15%">操作</th>
            </tr>

            <c:forEach items="${probs}" var="prob">
                <tr>
                    <td class="pid" align="center"><input class="check" name="checks" value="${prob.pid}" type="checkbox"/></td>
                    <td class="ptitle">${prob.ptitle}</td>
                    <td>${prob.pdate}</td>
                    <td align="center">${prob.pover}天</td>
                    <td align="center"><span class="layui-btn layui-btn-mini
                    <c:if test="${prob.ppass=='已通过'}"> layui-btn-role</c:if>
                    <c:if test="${prob.ppass=='未通过'}"> layui-btn-warm</c:if>">${prob.ppass}</span>
                    </td>
                    <td align="center">
                        <button class="layui-btn layui-btn-small layui-btn-delete" onclick="return detail(this);">查看详情
                        </button>
                    </td>
                </tr>
            </c:forEach>
        </table>
    </form>
</div>
</body>
</html>
